<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="_meta :: header">
    <title>列表</title>
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">音转视管理</a>
            <a>
              <cite>被驳回音转视</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="float: right;height: 30px;line-height: 30px;margin-top: 5px;" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form action="#" class="layui-form layui-col-space5" th:action="@{/audio/audio}" method="post">
                        <div class="layui-inline ">
                            <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.draftId}" name="draftId" placeholder="搜索稿件id" id="draftId" />
                        </div>
                        <!--                        <div class="layui-inline ">-->
                        <!--                            <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.audioUrl}" name="audioUrl" placeholder="搜索音频地址" id="audioUrl" />-->
                        <!--                        </div>-->
<!--                        <div class="layui-inline ">-->
<!--                            <input type="text" class="layui-input timeSpace" placeholder="搜索提交时间" name="submitTimeSpace" th:value="${submitTimeSpace}" />-->
<!--                        </div>-->
                        <div class="layui-inline ">
                            <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.audioPerson}" name="audioPerson" placeholder="搜索音频制作人" id="audioPerson" />
                        </div>
<!--                        <div class="layui-inline ">-->
<!--                            <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.audioLength}" name="audioLength" placeholder="搜索音频时长" id="audioLength" />-->
<!--                        </div>-->
<!--                        <div class="layui-inline ">-->
<!--                            <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.statusCode}" name="statusCode" placeholder="搜索状态code" id="statusCode" />-->
<!--                        </div>-->
<!--                        <div class="layui-inline ">-->
<!--                            <input type="text"  step="0.001" class="layui-input"  th:value="${searchInfo.isDelete}" name="isDelete" placeholder="搜索是否删除" id="isDelete" />-->
<!--                        </div>-->
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn  layui-btn-success radius"><i class="layui-icon">&#xe615;</i>
                            </button>
                        </div>
                        <div class="cl pd-5 bg-1 bk-gray " >
							<span class="l">
                                <a href="javascript:;"
                                   onclick="deleteAll('/audio/audio/deleteAll')"
                                   class="layui-btn  layui-btn-danger radius"><i class="layui-icon">&#xe64d;</i> 批量删除</a>
                                <a href="javascript:;"
                                   onclick="layer_show('添加','/audio/audio/addBefore',900,500)"
                                   class="layui-btn  layui-btn-normal radius"><i class="layui-icon">&#xe600;</i> 添加</a>

                                <a href="javascript:;"
                                   onclick="getIds('/admin/audio/allotBefore')"
                                   class="layui-btn  layui-btn-normal radius"><i class="layui-icon">&#xe605;</i> 分配</a>

							</span>
                            <span class="r wei-height" style="float: right;margin-right: 20px">共有数据：<strong
                                    th:text="${pageInfo.total}"></strong> 条</span>
                        </div>
                        <div class="layui-card-body" style="text-align: center">
                            <table class="layui-table layui-form">
                                <thead>
                                <tr class="text-c">
                                    <th width="25"><input type="checkbox" name="" value="" lay-filter="checkall" lay-skin="primary"/></th>
                                    <th width="25">序号</th>
                                    <th width="40">稿件id</th>
                                    <th width="40">音频地址</th>
                                    <th width="40">提交时间</th>
                                    <th width="40">音频制作人</th>
                                    <th width="40">音频时长</th>
                                    <th width="40">状态code</th>
                                    <th width="40">是否删除</th>
                                    <th width="40">创建时间</th>
                                    <!--                                        <th width="40">修改时间</th>-->
                                    <th width="100">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr class="text-c" th:if="${pageInfo.list.size() == 0}">
                                    <td colspan="15"><strong>暂无数据</strong></td>
                                </tr>
                                <tr class="text-c" th:each="audio,count:${pageInfo.list}">
                                    <td><input type="checkbox" value="1" th:value="${audio.id}"
                                               name="id" lay-skin="primary"/></td>
                                    <td th:text="${count.count}"></td>
                                    <td th:text="${audio.draftId}"></td>
                                    <td><audio th:src="${audio.audioUrl}" id="fileVideo" controls="controls"></audio></td>
                                    <td th:text="${#temporals.format(audio.submitTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                    <td th:text="${audio.audioPerson}"></td>
                                    <td th:text="${audio.audioLength}"></td>
                                    <td th:text="${audio.statusCode}"></td>
                                    <td th:text="${audio.isDelete}"></td>
                                    <td th:text="${#temporals.format(audio.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                    <!--                                            <td th:text="${#temporals.format(audio.updateTime, 'yyyy-MM-dd HH:mm:ss')}"></td>-->
                                    <td class="td-manage">
                                        <a title="编辑" href="javascript:;"
                                           th:onclick="'javascript:layer_show(\'编辑\',\'/audio/'+'audio'+'/editBefore/'+${audio.id}+'\',900,500)'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe642;</i></a>
                                        <a title="删除" href="javascript:;"
                                           th:onclick="'javascript:deleteById(\'/audio/'+'audio'+'/delete/'+${audio.id}+'\')'"
                                           class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe640;</i></a>
                                        <!--                                    <a title="查看" href="javascript:;"-->
                                        <!--                                       th:onclick="'javascript:layer_show(\'查看\',\'/admin/'+'audio'+'/detailAudio/'+${audio.id}+'\',900,500)'"-->
                                        <!--                                       class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe66e;</i></a>-->
                                        <label for="dowonMake" title="点击下载">
                                            <a title="下载"
                                               class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe601;</i></a>
                                        </label>
                                        <input style="display: none" id="dowonMake" type="button"
                                               th:onclick="'javascript:downLoadfileByte()'" >
                                        <label for="fileupload" title="点击上传">
                                            <a title="上传"
                                               class="ml-5" style="text-decoration:none"><i class="layui-icon">&#xe681;</i></a>
                                        </label>
                                        <input style="display: none" id="fileupload" type="file"  name="file"
                                               multiple="multiple"   th:data-url="${'/admin/fileUpload/uploadAudioVideo?draftId='+audio.draftId+'&groupId='+audio.groupId}">

                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div th:include="_pagination :: page"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs">
</div>

<link rel="stylesheet" type="text/css" th:href="@{/xadmin/lib/formSelect/formSelects-v4.css}"/>
<script type="text/javascript" th:src="@{/xadmin/lib/formselect/formSelects-v4.js}"></script>
<script th:src="@{/xadmin/lib/jQuery-File-Upload/js/vendor/jquery.ui.widget.js}"></script>
<script th:src="@{/xadmin/lib/jQuery-File-Upload/js/jquery.iframe-transport.js}"></script>
<script th:src="@{/xadmin/lib/jQuery-File-Upload/js/jquery.fileupload.js}"></script>
<!--/_footer 作为公共模版分离出去-->
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        // 监听全选
        form.on('checkbox(checkall)', function(data){

            if(data.elem.checked){
                $('tbody input').prop('checked',true);
            }else{
                $('tbody input').prop('checked',false);
            }
            form.render('checkbox');
        });
        form.on('select(selectchange)', function(data){
            console.log(data.value); //得到被选中的值
            var pageNo = $('#pageNo');
            var Form = $('form')
            pageNo.val(1);
            Form.submit();
            form.render('select');
        });
        //日期时间范围选择
        laydate.render({

        });
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,type: 'datetime'
                ,range: true //或 range: '~' 来自定义分割字符
            });
        });
    });

    // 分配--弹出层
    /**
     * 张雪
     * 传值  ids放入string中
     */
    function getIds(url){
        var ids = "";
        $('input[name="id"]:checked').each(
            function (i){
                ids += $(this).val()+",";
            });
        if(ids.trim().length == 0){
            layer.msg("您还未选择要分配的数据");
            return false;
        }
        layer_show("分配",url+"?ids="+ids);
    }


    //上传视频
    $(function () {
        $('#fileupload').fileupload({
            dataType: 'json',
            change: function (e, data) {
                var len = $('.imgcon').children().length;
                if (data.files.length > (1 - parseInt(len))) {
                    layer.msg('最多上传1张图片');
                    return false;
                }
            },
            start: function (e) {
                layer_msg = layer.msg('正在上传中…', {time: 100000000});
            },
            progressall: function (e, data) {
                $('.layui-layer-msg .layui-layer-content').html('已上传' + (data.loaded / data.total * 100).toFixed(2) + '%');
            },
            done: function (e, data) {
                layer.close(layer_msg);
            }
        });

    });


    //下载
    function  downLoadfileByte() {
        var file=$('#fileVideo').val();
        var	data ={ "path":file };
        var url = "/admin/fileUpload/ossDownloadFile"//接口地址;
        DownLoad({ url:url,data:data});
    };

    function DownLoad(options) {
        var inputs="";
        var config = $.extend(true, { method: 'post' }, options);
        var $iframe = $('<iframe id="down-file-iframe" />');
        var $form = $('<form target="down-file-iframe" method="' + config.method + '" />');
        $form.attr('action', config.url);
        for (var key in config.data) {
            $form.append('<input type="hidden" name="' + key + '" value="' + config.data[key] + '" />');
            inputs= '<input type="hidden" name="' + key + '" value="' + config.data[key] + '" />'
        }
        $iframe.append($form);
        $(document.body).append($iframe);
        $form[0].submit().remove();
        // jQuery('<form action="'+ config.url +'" method="'+ ('post') +'">'+inputs+'</form>').appendTo('body').submit().remove();
    }






</script>
</body>
</html>